// pages/mch/invoice/index.js
const App = getApp()

Page({
  data: {
    init: false,
    tab: '1',
    tabIndex: 0,

    CustomBar: App.Global.CustomBar,

    apply: 0,
    entrust: 0,
    issue: 0,
  },
  onLoad() {
    this.setData({
      init: true,
    })
    // 测试接口
    // App.doPost({
    //   uri:'/app/merchant/violation/save',
    //   body:{
    //     order_id:250615235994696
    //   },
    //   fnSucc: resp => {
    //     console.log(resp,"sdfregrr")
    //   }
    // })
  },
  // 滑动切换
  doSwiperChange(e) {
    let target = e.detail.currentItemId
    if (this.data.tab === target) {
      return
    }
    this.setData({
      tab: target
    })
  },
  // 跳转页面
  toPage(e) {
    wx.navigateTo({
      url: e.currentTarget.dataset.uri
    })
  },
  onTotalSet(e) {
    if (e.detail.type == 'apply') {
      this.setData({
        apply: e.detail.value
      })
    } else if (e.detail.type == 'entrust') {
      this.setData({
        entrust: e.detail.value
      })
    } else if (e.detail.type == 'issue') {
      this.setData({
        issue: e.detail.value
      })
    }
  },
  toSwiper(e) {
    this.setData({
      tabIndex: parseInt(e.currentTarget.dataset.idx)
    })
  }
})